import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
  name: 'myDate'
})
export class MyDatePipe implements PipeTransform {

  transform(value: any, args?: any): any {
    const y = new Date(value).getFullYear();
    const m = new Date(value).getMonth() + 1;
    const d = new Date(value).getDate();
    let date;
    if (value) {
      date = y + '-' + m + '-' + d;
    }
    return date;
  }

}
